import { BaseEntity } from '@libs/common/entities';
import { Column, Entity, JoinColumn, OneToOne } from 'typeorm';

import { DeviceRoad } from '@/atm/device-road/entities/device-road.entity';
import { Product } from '@/market/product/entities/product.entity';

@Entity('crm_node_atm_device_cargo_lane')
export class DeviceCargoLane extends BaseEntity {
  @JoinColumn({ name: 'product' })
  product?: Product;

  @Column({ comment: '商品ID', default: null })
  productId?: string;

  @Column({ comment: '设备货道ID', nullable: true })
  @OneToOne(() => DeviceRoad)
  @JoinColumn({ name: 'device_road' })
  deviceRoad: DeviceRoad;

  @Column({ comment: '当前货道库存', default: 0 })
  store?: number;
}
